package com.my.aslife.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.my.aslife.mapper.AddressMapper;
import com.my.aslife.module.common.ResponseResult;
import com.my.aslife.module.entity.Address;
import com.my.aslife.service.AddressService;
import org.springframework.stereotype.Service;

/**
 * (Address)表服务实现类
 *
 * @author makejava
 * @since 2023-02-26 19:03:42
 */
@Service("addressService")
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {


    @Override
    public ResponseResult insertAddress(Address address){

        save(address);

        return ResponseResult.ok();
    }

    @Override
    public Address queryAddressByDemandKey(Long demandKey) {
        LambdaQueryWrapper<Address> lqw = new LambdaQueryWrapper<>();
        lqw.eq(Address::getDemandKey, demandKey);
        return getOne(lqw);
    }

}
